#include "messagemanager.hpp"

MessageManager::MessageManager(): computing(false)
{}

void MessageManager::AddMessage(Message* m)
{
    messageList.push_back(m);
}

void MessageManager::ComputeAll()
{
    computingList.assign(messageList.begin(), messageList.end());
    messageList.clear();

    computing = true;

    while(!computingList.empty())
    {
        computingList.front()->Compute();
        delete computingList.front();
        computingList.erase(computingList.begin());
    }

    computing = false;
}
